{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import _pickle as cPickle"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 导入训练集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>location</th>\n",
       "      <th>age</th>\n",
       "      <th>item_id</th>\n",
       "      <th>rating</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2</td>\n",
       "      <td>usa</td>\n",
       "      <td>3</td>\n",
       "      <td>0195153448</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>7</td>\n",
       "      <td>usa</td>\n",
       "      <td>0</td>\n",
       "      <td>034542252</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>8</td>\n",
       "      <td>canada</td>\n",
       "      <td>0</td>\n",
       "      <td>0002005018</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>8</td>\n",
       "      <td>canada</td>\n",
       "      <td>0</td>\n",
       "      <td>0060973129</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>8</td>\n",
       "      <td>canada</td>\n",
       "      <td>0</td>\n",
       "      <td>0374157065</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   user_id location  age     item_id  rating\n",
       "0        2      usa    3  0195153448       0\n",
       "1        7      usa    0   034542252       0\n",
       "2        8   canada    0  0002005018       5\n",
       "3        8   canada    0  0060973129       0\n",
       "4        8   canada    0  0374157065       0"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_data_training = cPickle.load(open('../data/df_data_training.pkl', 'rb'))\n",
    "df_data_training.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 804841 entries, 0 to 1149771\n",
      "Data columns (total 5 columns):\n",
      "user_id     804841 non-null int64\n",
      "location    804841 non-null object\n",
      "age         804841 non-null int64\n",
      "item_id     804841 non-null object\n",
      "rating      804841 non-null int64\n",
      "dtypes: int64(3), object(2)\n",
      "memory usage: 36.8+ MB\n"
     ]
    }
   ],
   "source": [
    "df_data_training.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['usa',\n",
       " 'canada',\n",
       " 'united kingdom',\n",
       " 'germany',\n",
       " '',\n",
       " 'australia',\n",
       " 'spain',\n",
       " 'france',\n",
       " 'n/a',\n",
       " 'italy',\n",
       " 'portugal']"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_data_training['location'].value_counts()[:11].index.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "top10_location = ['usa',\n",
    " 'canada',\n",
    " 'united kingdom',\n",
    " 'germany',\n",
    " 'australia',\n",
    " 'spain',\n",
    " 'france',\n",
    " 'n/a',\n",
    " 'italy',\n",
    " 'portugal']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "df_data_training['location'] = df_data_training['location'].apply(lambda location: location if location in top10_location else 'other')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "usa               537641\n",
       "canada             72451\n",
       "other              60023\n",
       "united kingdom     35354\n",
       "germany            27687\n",
       "australia          18604\n",
       "spain              17949\n",
       "france              9735\n",
       "n/a                 9541\n",
       "italy               8482\n",
       "portugal            7374\n",
       "Name: location, dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_data_training['location'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\"\\nfeature_recommand = {\\n    'usa': {\\n        '0':[item1, item2, item3],\\n        '1':[item1, item2, item3],\\n    },\\n    'canada': {\\n        '0':[item1, item2, item3],\\n        '1':[item1, item2, item3],\\n    }\\n}\\nfeature_recommand_with_rating = {\\n    'usa': {\\n        '0':[{item1:10.0}, {item2: 9.7}, item3],\\n        '1':[item1, item2, item3],\\n    },\\n    'canada': {\\n        '0':[item1, item2, item3],\\n        '1':[item1, item2, item3],\\n    }\\n}\\n\""
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 推荐数据格式\n",
    "\"\"\"\n",
    "feature_recommand = {\n",
    "    'usa': {\n",
    "        '0':[item1, item2, item3],\n",
    "        '1':[item1, item2, item3],\n",
    "    },\n",
    "    'canada': {\n",
    "        '0':[item1, item2, item3],\n",
    "        '1':[item1, item2, item3],\n",
    "    }\n",
    "}\n",
    "feature_recommand_with_rating = {\n",
    "    'usa': {\n",
    "        '0':[{item1:10.0}, {item2: 9.7}, item3],\n",
    "        '1':[item1, item2, item3],\n",
    "    },\n",
    "    'canada': {\n",
    "        '0':[item1, item2, item3],\n",
    "        '1':[item1, item2, item3],\n",
    "    }\n",
    "}\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "from collections import defaultdict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "feature_recommand = defaultdict(dict)\n",
    "feature_recommand_with_rating = defaultdict(dict)\n",
    "\n",
    "for location, groupby_location in df_data_training.groupby('location'):\n",
    "    for age, groupby_location_age in groupby_location.groupby('age'):\n",
    "        # item_id 数量\n",
    "        item_id_value_counts = groupby_location_age['item_id'].value_counts()\n",
    "        # 百分数最大值\n",
    "        divide_boundary = max(np.percentile(item_id_value_counts, 75), 5)\n",
    "        groupby_location_age_top = groupby_location_age[\n",
    "            groupby_location_age['item_id'].isin(\n",
    "                item_id_value_counts[item_id_value_counts >= divide_boundary].index\n",
    "            )\n",
    "        ]\n",
    "        # item 打分均值\n",
    "        item_mean_rating = groupby_location_age_top.groupby('item_id')['rating'].mean().sort_values(ascending=False)[:20]\n",
    "        feature_recommand[location][age] = [\n",
    "            item_id\n",
    "            for item_id in item_mean_rating.index if item_mean_rating[item_id] >= 5\n",
    "        ]\n",
    "        feature_recommand_with_rating[location][age] = [\n",
    "            {\"%s\" % item_id: round(item_mean_rating[item_id], 2)}\n",
    "            for item_id in item_mean_rating.index if item_mean_rating[item_id] >= 5\n",
    "        ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defaultdict(dict,\n",
       "            {'australia': {0: ['0099771519', '1857022424'],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['0552998486',\n",
       "               '015602943X',\n",
       "               '0552140295',\n",
       "               '0440220602',\n",
       "               '0446532231',\n",
       "               '0007170866',\n",
       "               '1875989218',\n",
       "               '0099727412',\n",
       "               '0860074382',\n",
       "               '0140008535',\n",
       "               '0385335482',\n",
       "               '0553279556',\n",
       "               '1400034779',\n",
       "               '0743225082',\n",
       "               '0949206318'],\n",
       "              4: ['0091867770'],\n",
       "              5: []},\n",
       "             'canada': {0: ['0140505865',\n",
       "               '0140067477',\n",
       "               '076790592X',\n",
       "               '0553250426',\n",
       "               '0060392452',\n",
       "               '0676974791',\n",
       "               '080410526X',\n",
       "               '1552783081',\n",
       "               '0446350982',\n",
       "               '038079487X',\n",
       "               '0385505833',\n",
       "               '0676972152',\n",
       "               '0786867647',\n",
       "               '0060959037',\n",
       "               '0771099894',\n",
       "               '0812550706',\n",
       "               '0425122123',\n",
       "               '0446667900',\n",
       "               '0671011375',\n",
       "               '1550541129'],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['0060915544',\n",
       "               '0140042393',\n",
       "               '0552137030',\n",
       "               '0836220889',\n",
       "               '0425105334',\n",
       "               '0836218256',\n",
       "               '0140277439',\n",
       "               '0345338588',\n",
       "               '1853260002',\n",
       "               '0060935464',\n",
       "               '0836218353',\n",
       "               '0671868691',\n",
       "               '0446532231',\n",
       "               '038542017X',\n",
       "               '0440224764',\n",
       "               '0770422578',\n",
       "               '0006485278',\n",
       "               '0451163524',\n",
       "               '0771060548',\n",
       "               '0553287893'],\n",
       "              4: ['0380718839',\n",
       "               '0316666343',\n",
       "               '0345370775',\n",
       "               '0684872153',\n",
       "               '0671758896',\n",
       "               '0676974805',\n",
       "               '0440213525',\n",
       "               '0515111279',\n",
       "               '034540288X',\n",
       "               '0676973094',\n",
       "               '0671027360',\n",
       "               '0684874350'],\n",
       "              5: []},\n",
       "             'france': {0: [],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['2070370003',\n",
       "               '2070408507',\n",
       "               '2253140872',\n",
       "               '2266084372',\n",
       "               '2877302202',\n",
       "               '22530152730',\n",
       "               '2070744833',\n",
       "               '2253072079',\n",
       "               '2277260029',\n",
       "               '2290302155',\n",
       "               '2070363317',\n",
       "               '2253153265',\n",
       "               '2253144452',\n",
       "               '2264016124',\n",
       "               '2226135022',\n",
       "               '2020306492',\n",
       "               '2253154393',\n",
       "               '2290308285',\n",
       "               '2253150711',\n",
       "               '229030039X'],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'germany': {0: ['3518366823',\n",
       "               '3423072571',\n",
       "               '3518368540',\n",
       "               '3423203668',\n",
       "               '3426029553',\n",
       "               '3453007867',\n",
       "               '3404148665'],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['3551551936',\n",
       "               '3551551693',\n",
       "               '3551551677',\n",
       "               '3423071516',\n",
       "               '3518372742',\n",
       "               '3257230478',\n",
       "               '3442727952',\n",
       "               '3442724686',\n",
       "               '3518100734',\n",
       "               '3596215226',\n",
       "               '3150000017',\n",
       "               '3426612704',\n",
       "               '3423205202',\n",
       "               '3499224615',\n",
       "               '3423202947',\n",
       "               '3442442354',\n",
       "               '3453071174',\n",
       "               '3551551685',\n",
       "               '3423204206',\n",
       "               '3518388762'],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'italy': {0: ['8806142100',\n",
       "               '8826703132',\n",
       "               '884590184X',\n",
       "               '8817131628'],\n",
       "              2: [],\n",
       "              3: ['8845205118',\n",
       "               '8807813823',\n",
       "               '8845915700',\n",
       "               '8817106259',\n",
       "               '8807701510',\n",
       "               '8807816067',\n",
       "               '881786983X',\n",
       "               '0743222229',\n",
       "               '8807817039',\n",
       "               '8807814684',\n",
       "               '8806161741',\n",
       "               '884541096X',\n",
       "               '8845290077',\n",
       "               '8817106100',\n",
       "               '0451164075',\n",
       "               '8807816059',\n",
       "               '8804342838',\n",
       "               '9770390107900'],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'n/a': {0: [], 3: [], 4: []},\n",
       "             'other': {0: ['8826703132',\n",
       "               '0060008024',\n",
       "               '0439064872',\n",
       "               '1558743669',\n",
       "               '0440211727',\n",
       "               '0330332775',\n",
       "               '0140298479',\n",
       "               '0380789019',\n",
       "               '034536676X',\n",
       "               '0446679593',\n",
       "               '0316693251',\n",
       "               '0316693006',\n",
       "               '1400034779',\n",
       "               '0345337662',\n",
       "               '0375706771',\n",
       "               '0385335881',\n",
       "               '0345339681',\n",
       "               '0553296981',\n",
       "               '044651652X',\n",
       "               '0062502182'],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['0553296981',\n",
       "               '0441001971',\n",
       "               '0590353403',\n",
       "               '0671793489',\n",
       "               '0553213148',\n",
       "               '0515131229',\n",
       "               '0446310786',\n",
       "               '0439139597',\n",
       "               '0345378490',\n",
       "               '0747546290',\n",
       "               '0842329218',\n",
       "               '0312924585',\n",
       "               '3257228007',\n",
       "               '0786868716',\n",
       "               '051513628X',\n",
       "               '0151008116',\n",
       "               '0061092177',\n",
       "               '0375702709',\n",
       "               '0099800403',\n",
       "               '0439136350'],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'portugal': {0: [],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['038082101X',\n",
       "               '0439139600',\n",
       "               '0380815923',\n",
       "               '006050918X',\n",
       "               '9505156944',\n",
       "               '0380977788',\n",
       "               '002542730X',\n",
       "               '0460877305',\n",
       "               '0385721234',\n",
       "               '0385413041',\n",
       "               '9726081378',\n",
       "               '0811214982',\n",
       "               '0330262130',\n",
       "               '0880381744',\n",
       "               '0552137030',\n",
       "               '9722113747',\n",
       "               '9580464162',\n",
       "               '9724614565',\n",
       "               '1401201385'],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'spain': {0: [],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['8445071416',\n",
       "               '8420616893',\n",
       "               '8420613487',\n",
       "               '950491036X',\n",
       "               '8478886508',\n",
       "               '8478886451',\n",
       "               '0156013924',\n",
       "               '8408039369',\n",
       "               '8420636282',\n",
       "               '8495501074',\n",
       "               '8420432113',\n",
       "               '8440627203',\n",
       "               '8445071408',\n",
       "               '0452282152',\n",
       "               '9681501225',\n",
       "               '8445071769',\n",
       "               '8420466034',\n",
       "               '8445071394',\n",
       "               '8423309223',\n",
       "               '8433914545'],\n",
       "              4: ['8408043641'],\n",
       "              5: []},\n",
       "             'united kingdom': {0: ['0590660543',\n",
       "               '000649840X',\n",
       "               '0330367358',\n",
       "               '0330376519',\n",
       "               '1857027051',\n",
       "               '0749395990',\n",
       "               '0552124753',\n",
       "               '0099771519',\n",
       "               '0749399902'],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: ['1844262553',\n",
       "               '0091891965',\n",
       "               '0140620117',\n",
       "               '0330258648',\n",
       "               '1860465811',\n",
       "               '1857231384',\n",
       "               '0552145424',\n",
       "               '0440206154',\n",
       "               '0552131059',\n",
       "               '0192833596',\n",
       "               '0440235596',\n",
       "               '0552142379',\n",
       "               '0330267388',\n",
       "               '0671024337',\n",
       "               '0380002930',\n",
       "               '0722532938',\n",
       "               '0552149519',\n",
       "               '0140287248',\n",
       "               '0380813815',\n",
       "               '0064407667'],\n",
       "              4: ['1844262553', '0552147680', '0552131067', '0552996181'],\n",
       "              5: []},\n",
       "             'usa': {0: ['0156004801',\n",
       "               '0060256672',\n",
       "               '0971942315',\n",
       "               '1576738167',\n",
       "               '0553351397',\n",
       "               '0441002935',\n",
       "               '0615116426',\n",
       "               '0316735027',\n",
       "               '0140309578',\n",
       "               '0140185232',\n",
       "               '0553148001',\n",
       "               '0395977894',\n",
       "               '0743455967',\n",
       "               '0618002235',\n",
       "               '039480029X',\n",
       "               '0877738513',\n",
       "               '0060248025',\n",
       "               '0807083054',\n",
       "               '0553380958',\n",
       "               '0553213504'],\n",
       "              1: ['0064407667', '0439064872', '059035342X'],\n",
       "              2: ['0590353403',\n",
       "               '0440237688',\n",
       "               '0451191137',\n",
       "               '0439139597',\n",
       "               '0679886370',\n",
       "               '0140348107',\n",
       "               '0064472272',\n",
       "               '0439064864',\n",
       "               '0671027344',\n",
       "               '0446608955',\n",
       "               '0394820371',\n",
       "               '0385729332',\n",
       "               '0316666343',\n",
       "               '0385729340',\n",
       "               '0385730586',\n",
       "               '043935806X',\n",
       "               '0439136350',\n",
       "               '1576738159',\n",
       "               '0440439884',\n",
       "               '0345342968'],\n",
       "              3: ['0066238501',\n",
       "               '0517693119',\n",
       "               '0394800389',\n",
       "               '0920668364',\n",
       "               '0395177111',\n",
       "               '0890876789',\n",
       "               '0898159954',\n",
       "               '0316286850',\n",
       "               '0375503803',\n",
       "               '0316779059',\n",
       "               '156402976X',\n",
       "               '0553110845',\n",
       "               '0060256737',\n",
       "               '0060968966',\n",
       "               '0670451932',\n",
       "               '0805013407',\n",
       "               '0060961325',\n",
       "               '0140195831',\n",
       "               '0451525663',\n",
       "               '0451171926'],\n",
       "              4: ['0312303467',\n",
       "               '0060514957',\n",
       "               '0553377868',\n",
       "               '0688167888',\n",
       "               '0399151451',\n",
       "               '1579546463',\n",
       "               '0380977311',\n",
       "               '0553379615',\n",
       "               '0943233828',\n",
       "               '0446532452',\n",
       "               '0553565079',\n",
       "               '0066214769',\n",
       "               '0446322180',\n",
       "               '0439064864',\n",
       "               '0399151613',\n",
       "               '0449911519',\n",
       "               '0451169514',\n",
       "               '0553802461',\n",
       "               '0312983220',\n",
       "               '0312983301'],\n",
       "              5: ['0440234743', '044022165X']}})"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "feature_recommand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defaultdict(dict,\n",
       "            {'australia': {0: [{'0099771519': 7.0}, {'1857022424': 5.33}],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'0552998486': 8.8},\n",
       "               {'015602943X': 7.2},\n",
       "               {'0552140295': 6.8},\n",
       "               {'0440220602': 6.6},\n",
       "               {'0446532231': 6.2},\n",
       "               {'0007170866': 6.14},\n",
       "               {'1875989218': 6.09},\n",
       "               {'0099727412': 6.0},\n",
       "               {'0860074382': 5.91},\n",
       "               {'0140008535': 5.86},\n",
       "               {'0385335482': 5.71},\n",
       "               {'0553279556': 5.67},\n",
       "               {'1400034779': 5.4},\n",
       "               {'0743225082': 5.33},\n",
       "               {'0949206318': 5.17}],\n",
       "              4: [{'0091867770': 5.17}],\n",
       "              5: []},\n",
       "             'canada': {0: [{'0140505865': 9.4},\n",
       "               {'0140067477': 7.86},\n",
       "               {'076790592X': 7.4},\n",
       "               {'0553250426': 7.12},\n",
       "               {'0060392452': 7.0},\n",
       "               {'0676974791': 6.83},\n",
       "               {'080410526X': 6.8},\n",
       "               {'1552783081': 6.8},\n",
       "               {'0446350982': 6.8},\n",
       "               {'038079487X': 6.6},\n",
       "               {'0385505833': 6.4},\n",
       "               {'0676972152': 6.4},\n",
       "               {'0786867647': 6.4},\n",
       "               {'0060959037': 6.38},\n",
       "               {'0771099894': 6.25},\n",
       "               {'0812550706': 6.2},\n",
       "               {'0425122123': 6.2},\n",
       "               {'0446667900': 6.12},\n",
       "               {'0671011375': 6.0},\n",
       "               {'1550541129': 6.0}],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'0060915544': 8.43},\n",
       "               {'0140042393': 8.33},\n",
       "               {'0552137030': 8.29},\n",
       "               {'0836220889': 7.83},\n",
       "               {'0425105334': 7.8},\n",
       "               {'0836218256': 7.67},\n",
       "               {'0140277439': 7.6},\n",
       "               {'0345338588': 7.6},\n",
       "               {'1853260002': 7.5},\n",
       "               {'0060935464': 7.4},\n",
       "               {'0836218353': 7.2},\n",
       "               {'0671868691': 7.17},\n",
       "               {'0446532231': 7.15},\n",
       "               {'038542017X': 7.14},\n",
       "               {'0440224764': 7.0},\n",
       "               {'0770422578': 7.0},\n",
       "               {'0006485278': 7.0},\n",
       "               {'0451163524': 7.0},\n",
       "               {'0771060548': 6.89},\n",
       "               {'0553287893': 6.83}],\n",
       "              4: [{'0380718839': 8.4},\n",
       "               {'0316666343': 7.57},\n",
       "               {'0345370775': 7.0},\n",
       "               {'0684872153': 6.6},\n",
       "               {'0671758896': 6.2},\n",
       "               {'0676974805': 6.0},\n",
       "               {'0440213525': 5.57},\n",
       "               {'0515111279': 5.43},\n",
       "               {'034540288X': 5.29},\n",
       "               {'0676973094': 5.22},\n",
       "               {'0671027360': 5.2},\n",
       "               {'0684874350': 5.0}],\n",
       "              5: []},\n",
       "             'france': {0: [],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'2070370003': 9.0},\n",
       "               {'2070408507': 7.33},\n",
       "               {'2253140872': 7.14},\n",
       "               {'2266084372': 7.12},\n",
       "               {'2877302202': 6.8},\n",
       "               {'22530152730': 6.6},\n",
       "               {'2070744833': 6.57},\n",
       "               {'2253072079': 6.4},\n",
       "               {'2277260029': 6.4},\n",
       "               {'2290302155': 6.33},\n",
       "               {'2070363317': 6.2},\n",
       "               {'2253153265': 6.2},\n",
       "               {'2253144452': 6.17},\n",
       "               {'2264016124': 6.17},\n",
       "               {'2226135022': 6.12},\n",
       "               {'2020306492': 6.0},\n",
       "               {'2253154393': 6.0},\n",
       "               {'2290308285': 5.89},\n",
       "               {'2253150711': 5.71},\n",
       "               {'229030039X': 5.6}],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'germany': {0: [{'3518366823': 6.8},\n",
       "               {'3423072571': 6.2},\n",
       "               {'3518368540': 6.0},\n",
       "               {'3423203668': 5.33},\n",
       "               {'3426029553': 5.25},\n",
       "               {'3453007867': 5.17},\n",
       "               {'3404148665': 5.0}],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'3551551936': 9.6},\n",
       "               {'3551551693': 9.5},\n",
       "               {'3551551677': 9.5},\n",
       "               {'3423071516': 9.0},\n",
       "               {'3518372742': 8.0},\n",
       "               {'3257230478': 7.67},\n",
       "               {'3442727952': 7.43},\n",
       "               {'3442724686': 7.33},\n",
       "               {'3518100734': 7.33},\n",
       "               {'3596215226': 7.3},\n",
       "               {'3150000017': 7.14},\n",
       "               {'3426612704': 6.89},\n",
       "               {'3423205202': 6.88},\n",
       "               {'3499224615': 6.71},\n",
       "               {'3423202947': 6.7},\n",
       "               {'3442442354': 6.67},\n",
       "               {'3453071174': 6.6},\n",
       "               {'3551551685': 6.5},\n",
       "               {'3423204206': 6.44},\n",
       "               {'3518388762': 6.4}],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'italy': {0: [{'8806142100': 6.33},\n",
       "               {'8826703132': 6.08},\n",
       "               {'884590184X': 6.0},\n",
       "               {'8817131628': 5.2}],\n",
       "              2: [],\n",
       "              3: [{'8845205118': 7.67},\n",
       "               {'8807813823': 7.2},\n",
       "               {'8845915700': 7.17},\n",
       "               {'8817106259': 6.29},\n",
       "               {'8807701510': 6.2},\n",
       "               {'8807816067': 6.18},\n",
       "               {'881786983X': 6.0},\n",
       "               {'0743222229': 5.86},\n",
       "               {'8807817039': 5.83},\n",
       "               {'8807814684': 5.5},\n",
       "               {'8806161741': 5.4},\n",
       "               {'884541096X': 5.4},\n",
       "               {'8845290077': 5.29},\n",
       "               {'8817106100': 5.25},\n",
       "               {'0451164075': 5.2},\n",
       "               {'8807816059': 5.1},\n",
       "               {'8804342838': 5.09},\n",
       "               {'9770390107900': 5.0}],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'n/a': {0: [], 3: [], 4: []},\n",
       "             'other': {0: [{'8826703132': 9.0},\n",
       "               {'0060008024': 8.0},\n",
       "               {'0439064872': 7.38},\n",
       "               {'1558743669': 7.2},\n",
       "               {'0440211727': 7.0},\n",
       "               {'0330332775': 6.8},\n",
       "               {'0140298479': 6.67},\n",
       "               {'0380789019': 6.6},\n",
       "               {'034536676X': 6.5},\n",
       "               {'0446679593': 6.43},\n",
       "               {'0316693251': 6.4},\n",
       "               {'0316693006': 6.4},\n",
       "               {'1400034779': 6.23},\n",
       "               {'0345337662': 6.2},\n",
       "               {'0375706771': 6.2},\n",
       "               {'0385335881': 6.2},\n",
       "               {'0345339681': 6.17},\n",
       "               {'0553296981': 6.17},\n",
       "               {'044651652X': 6.12},\n",
       "               {'0062502182': 6.0}],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'0553296981': 9.38},\n",
       "               {'0441001971': 8.6},\n",
       "               {'0590353403': 8.5},\n",
       "               {'0671793489': 8.4},\n",
       "               {'0553213148': 7.6},\n",
       "               {'0515131229': 7.4},\n",
       "               {'0446310786': 7.3},\n",
       "               {'0439139597': 7.22},\n",
       "               {'0345378490': 7.2},\n",
       "               {'0747546290': 7.14},\n",
       "               {'0842329218': 7.14},\n",
       "               {'0312924585': 7.0},\n",
       "               {'3257228007': 6.86},\n",
       "               {'0786868716': 6.83},\n",
       "               {'051513628X': 6.8},\n",
       "               {'0151008116': 6.8},\n",
       "               {'0061092177': 6.8},\n",
       "               {'0375702709': 6.8},\n",
       "               {'0099800403': 6.5},\n",
       "               {'0439136350': 6.45}],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'portugal': {0: [],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'038082101X': 8.86},\n",
       "               {'0439139600': 7.33},\n",
       "               {'0380815923': 6.6},\n",
       "               {'006050918X': 6.4},\n",
       "               {'9505156944': 6.33},\n",
       "               {'0380977788': 5.86},\n",
       "               {'002542730X': 5.75},\n",
       "               {'0460877305': 5.71},\n",
       "               {'0385721234': 5.5},\n",
       "               {'0385413041': 5.4},\n",
       "               {'9726081378': 5.4},\n",
       "               {'0811214982': 5.3},\n",
       "               {'0330262130': 5.2},\n",
       "               {'0880381744': 5.2},\n",
       "               {'0552137030': 5.2},\n",
       "               {'9722113747': 5.17},\n",
       "               {'9580464162': 5.0},\n",
       "               {'9724614565': 5.0},\n",
       "               {'1401201385': 5.0}],\n",
       "              4: [],\n",
       "              5: []},\n",
       "             'spain': {0: [],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'8445071416': 8.69},\n",
       "               {'8420616893': 8.62},\n",
       "               {'8420613487': 8.6},\n",
       "               {'950491036X': 8.43},\n",
       "               {'8478886508': 8.4},\n",
       "               {'8478886451': 8.4},\n",
       "               {'0156013924': 7.8},\n",
       "               {'8408039369': 7.8},\n",
       "               {'8420636282': 7.6},\n",
       "               {'8495501074': 7.43},\n",
       "               {'8420432113': 7.2},\n",
       "               {'8440627203': 7.17},\n",
       "               {'8445071408': 7.0},\n",
       "               {'0452282152': 7.0},\n",
       "               {'9681501225': 7.0},\n",
       "               {'8445071769': 6.8},\n",
       "               {'8420466034': 6.8},\n",
       "               {'8445071394': 6.8},\n",
       "               {'8423309223': 6.62},\n",
       "               {'8433914545': 6.62}],\n",
       "              4: [{'8408043641': 6}],\n",
       "              5: []},\n",
       "             'united kingdom': {0: [{'0590660543': 6.33},\n",
       "               {'000649840X': 6.17},\n",
       "               {'0330367358': 6.0},\n",
       "               {'0330376519': 6.0},\n",
       "               {'1857027051': 6.0},\n",
       "               {'0749395990': 5.67},\n",
       "               {'0552124753': 5.6},\n",
       "               {'0099771519': 5.33},\n",
       "               {'0749399902': 5.0}],\n",
       "              1: [],\n",
       "              2: [],\n",
       "              3: [{'1844262553': 8.35},\n",
       "               {'0091891965': 8.2},\n",
       "               {'0140620117': 7.17},\n",
       "               {'0330258648': 7.0},\n",
       "               {'1860465811': 7.0},\n",
       "               {'1857231384': 7.0},\n",
       "               {'0552145424': 6.83},\n",
       "               {'0440206154': 6.67},\n",
       "               {'0552131059': 6.62},\n",
       "               {'0192833596': 6.6},\n",
       "               {'0440235596': 6.6},\n",
       "               {'0552142379': 6.5},\n",
       "               {'0330267388': 6.4},\n",
       "               {'0671024337': 6.4},\n",
       "               {'0380002930': 6.4},\n",
       "               {'0722532938': 6.38},\n",
       "               {'0552149519': 6.2},\n",
       "               {'0140287248': 6.17},\n",
       "               {'0380813815': 6.17},\n",
       "               {'0064407667': 6.12}],\n",
       "              4: [{'1844262553': 8.5},\n",
       "               {'0552147680': 6.6},\n",
       "               {'0552131067': 5.8},\n",
       "               {'0552996181': 5.0}],\n",
       "              5: []},\n",
       "             'usa': {0: [{'0156004801': 9.6},\n",
       "               {'0060256672': 9.33},\n",
       "               {'0971942315': 9.0},\n",
       "               {'1576738167': 9.0},\n",
       "               {'0553351397': 8.83},\n",
       "               {'0441002935': 8.6},\n",
       "               {'0615116426': 8.45},\n",
       "               {'0316735027': 8.33},\n",
       "               {'0140309578': 8.33},\n",
       "               {'0140185232': 8.2},\n",
       "               {'0553148001': 8.17},\n",
       "               {'0395977894': 8.1},\n",
       "               {'0743455967': 8.0},\n",
       "               {'0618002235': 8.0},\n",
       "               {'039480029X': 8.0},\n",
       "               {'0877738513': 8.0},\n",
       "               {'0060248025': 8.0},\n",
       "               {'0807083054': 7.89},\n",
       "               {'0553380958': 7.8},\n",
       "               {'0553213504': 7.8}],\n",
       "              1: [{'0064407667': 9.6},\n",
       "               {'0439064872': 8.0},\n",
       "               {'059035342X': 7.33}],\n",
       "              2: [{'0590353403': 9.44},\n",
       "               {'0440237688': 9.4},\n",
       "               {'0451191137': 8.8},\n",
       "               {'0439139597': 8.36},\n",
       "               {'0679886370': 8.17},\n",
       "               {'0140348107': 8.0},\n",
       "               {'0064472272': 7.71},\n",
       "               {'0439064864': 7.67},\n",
       "               {'0671027344': 7.64},\n",
       "               {'0446608955': 7.56},\n",
       "               {'0394820371': 7.43},\n",
       "               {'0385729332': 7.33},\n",
       "               {'0316666343': 7.29},\n",
       "               {'0385729340': 7.2},\n",
       "               {'0385730586': 7.0},\n",
       "               {'043935806X': 6.62},\n",
       "               {'0439136350': 6.6},\n",
       "               {'1576738159': 6.6},\n",
       "               {'0440439884': 6.4},\n",
       "               {'0345342968': 6.33}],\n",
       "              3: [{'0066238501': 9.88},\n",
       "               {'0517693119': 9.83},\n",
       "               {'0394800389': 9.83},\n",
       "               {'0920668364': 9.67},\n",
       "               {'0395177111': 9.5},\n",
       "               {'0890876789': 9.4},\n",
       "               {'0898159954': 9.4},\n",
       "               {'0316286850': 9.4},\n",
       "               {'0375503803': 9.2},\n",
       "               {'0316779059': 9.0},\n",
       "               {'156402976X': 9.0},\n",
       "               {'0553110845': 9.0},\n",
       "               {'0060256737': 8.83},\n",
       "               {'0060968966': 8.8},\n",
       "               {'0670451932': 8.8},\n",
       "               {'0805013407': 8.6},\n",
       "               {'0060961325': 8.6},\n",
       "               {'0140195831': 8.6},\n",
       "               {'0451525663': 8.6},\n",
       "               {'0451171926': 8.4}],\n",
       "              4: [{'0312303467': 9.4},\n",
       "               {'0060514957': 9.0},\n",
       "               {'0553377868': 8.86},\n",
       "               {'0688167888': 8.4},\n",
       "               {'0399151451': 8.0},\n",
       "               {'1579546463': 8.0},\n",
       "               {'0380977311': 7.86},\n",
       "               {'0553379615': 7.83},\n",
       "               {'0943233828': 7.8},\n",
       "               {'0446532452': 7.57},\n",
       "               {'0553565079': 7.4},\n",
       "               {'0066214769': 7.4},\n",
       "               {'0446322180': 7.29},\n",
       "               {'0439064864': 7.22},\n",
       "               {'0399151613': 7.2},\n",
       "               {'0449911519': 7.2},\n",
       "               {'0451169514': 7.17},\n",
       "               {'0553802461': 7.12},\n",
       "               {'0312983220': 7.0},\n",
       "               {'0312983301': 7.0}],\n",
       "              5: [{'0440234743': 7.6}, {'044022165X': 6.4}]}})"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "feature_recommand_with_rating"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### 找到热门商品"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['0971880107',\n",
       " '0316666343',\n",
       " '0385504209',\n",
       " '0312195516',\n",
       " '0060928336',\n",
       " '0679781587',\n",
       " '044023722X',\n",
       " '0142001740',\n",
       " '0316601950',\n",
       " '0671027360',\n",
       " '0446672211',\n",
       " '067976402X',\n",
       " '0375727345',\n",
       " '059035342X',\n",
       " '0440214041',\n",
       " '0452282152',\n",
       " '044021145X',\n",
       " '0440211727',\n",
       " '0345337662',\n",
       " '0804106304',\n",
       " '0440226430',\n",
       " '0156027321',\n",
       " '0060976845',\n",
       " '0060930535',\n",
       " '0440241073',\n",
       " '0345370775',\n",
       " '0743418174',\n",
       " '0671003755',\n",
       " '0671021001',\n",
       " '0312278586',\n",
       " '0446605239',\n",
       " '0786868716',\n",
       " '1400034779',\n",
       " '0440222656',\n",
       " '0440234743',\n",
       " '0345361792',\n",
       " '0440221471',\n",
       " '0440236673',\n",
       " '0316769487',\n",
       " '0385484518',\n",
       " '044022165X',\n",
       " '0345353145',\n",
       " '0345417623',\n",
       " '0440206154',\n",
       " '0446310786',\n",
       " '0375706771',\n",
       " '0446606812',\n",
       " '0060502258',\n",
       " '0446610038',\n",
       " '044651652X',\n",
       " '0440220602',\n",
       " '0440225701',\n",
       " '0439064872',\n",
       " '0345443284',\n",
       " '0671510053',\n",
       " '0440213525',\n",
       " '0140293248',\n",
       " '0060934417',\n",
       " '0385335482',\n",
       " '0452282829',\n",
       " '006101351X',\n",
       " '0375707972',\n",
       " '0375726403',\n",
       " '0440224764',\n",
       " '043935806X',\n",
       " '0316776963',\n",
       " '0316284955',\n",
       " '0312291639',\n",
       " '0385492081',\n",
       " '0385720106',\n",
       " '0345342968',\n",
       " '0385265700',\n",
       " '0684872153',\n",
       " '0380789035',\n",
       " '0375700757',\n",
       " '0375725784',\n",
       " '0060938455',\n",
       " '0553572997',\n",
       " '068484477X',\n",
       " '0842329129',\n",
       " '0316096199',\n",
       " '0385722206',\n",
       " '0061009059',\n",
       " '0312305060',\n",
       " '0060987103',\n",
       " '0440224675',\n",
       " '0553279912',\n",
       " '0345378490',\n",
       " '0671001795',\n",
       " '0142000205',\n",
       " '0345351525',\n",
       " '0446364193',\n",
       " '0684874350',\n",
       " '0345339681',\n",
       " '0060392452',\n",
       " '0446608955',\n",
       " '0316569321',\n",
       " '0743237188',\n",
       " '0446612545',\n",
       " '0446611867',\n",
       " '0345313860',\n",
       " '0515131229',\n",
       " '0440235596',\n",
       " '014028009X',\n",
       " '0805063897',\n",
       " '0449212602',\n",
       " '0380731851',\n",
       " '0345339703',\n",
       " '0553268880',\n",
       " '1558743669',\n",
       " '0671027387',\n",
       " '0345391055',\n",
       " '080410753X',\n",
       " '0440226104',\n",
       " '051513287X',\n",
       " '0679746048',\n",
       " '0345387651',\n",
       " '0380730138',\n",
       " '0679429220',\n",
       " '0446611212',\n",
       " '0804114986',\n",
       " '0345380371',\n",
       " '0385486804',\n",
       " '0380002930',\n",
       " '0060915544',\n",
       " '0425175405',\n",
       " '0060959037',\n",
       " '0399501487',\n",
       " '0064407667',\n",
       " '0786881852',\n",
       " '0440241537',\n",
       " '0446607657',\n",
       " '0446605484',\n",
       " '0312983271',\n",
       " '0553582755',\n",
       " '0345384466',\n",
       " '080410526X',\n",
       " '0312924585',\n",
       " '034540288X',\n",
       " '0553280341',\n",
       " '0451166892',\n",
       " '0060987529',\n",
       " '0380789019',\n",
       " '0425167313',\n",
       " '0312966091',\n",
       " '014025448X',\n",
       " '0062502182',\n",
       " '0140298479',\n",
       " '0449005615',\n",
       " '0439136369',\n",
       " '0140244824',\n",
       " '0679745203',\n",
       " '0425152251',\n",
       " '074343627X',\n",
       " '0425180638',\n",
       " '0380018179',\n",
       " '080411109X',\n",
       " '0060987561',\n",
       " '0425147622',\n",
       " '0425154092',\n",
       " '0070212570',\n",
       " '0446601241',\n",
       " '0440211263',\n",
       " '068484267X',\n",
       " '0446612790',\n",
       " '0449003795',\n",
       " '0060977493',\n",
       " '0515132020',\n",
       " '0671041789',\n",
       " '038079487X',\n",
       " '0743225406',\n",
       " '080411868X',\n",
       " '0061097101',\n",
       " '0385508042',\n",
       " '1573229326',\n",
       " '0312966970',\n",
       " '0385505833',\n",
       " '0871136791',\n",
       " '0425158616',\n",
       " '0671038184',\n",
       " '0345402871',\n",
       " '0312971346',\n",
       " '0767902521',\n",
       " '0609804138',\n",
       " '0312995423',\n",
       " '155874262X',\n",
       " '0451524934',\n",
       " '0812550706',\n",
       " '0385479565',\n",
       " '0553250426',\n",
       " '0425162443',\n",
       " '0345439104',\n",
       " '0141000198',\n",
       " '1400031354',\n",
       " '067102423X',\n",
       " '0385335881',\n",
       " '0440236703',\n",
       " '0449907481',\n",
       " '0446359866',\n",
       " '0312980140',\n",
       " '0440212561',\n",
       " '0380718340',\n",
       " '0425182908',\n",
       " '0671042858',\n",
       " '0767905180',\n",
       " '0375703055',\n",
       " '0425169863',\n",
       " '038550120X',\n",
       " '0316781266',\n",
       " '0380718332',\n",
       " '1559029838',\n",
       " '0553580221',\n",
       " '014023313X',\n",
       " '0553260111',\n",
       " '0385503822',\n",
       " '0671024248',\n",
       " '0316899984',\n",
       " '0066214122',\n",
       " '0312282990',\n",
       " '014029628X',\n",
       " '0451183665',\n",
       " '0439139597',\n",
       " '0743436210',\n",
       " '0451184963',\n",
       " '0439139600',\n",
       " '0553579606',\n",
       " '0375702709',\n",
       " '034538475X',\n",
       " '0441569595',\n",
       " '1573225789',\n",
       " '0671004530',\n",
       " '0345438329',\n",
       " '0446670251',\n",
       " '0671014196',\n",
       " '0553279378',\n",
       " '0446532231',\n",
       " '0515132187',\n",
       " '042511774X',\n",
       " '0439136350',\n",
       " '0553277472',\n",
       " '0446610399',\n",
       " '0140067477',\n",
       " '044651862X',\n",
       " '0590353403',\n",
       " '042516098X',\n",
       " '0451203771',\n",
       " '038572179X',\n",
       " '0316780375',\n",
       " '0671867156',\n",
       " '0399144463',\n",
       " '0375703861',\n",
       " '0425163407',\n",
       " '0452264464',\n",
       " '0440180295',\n",
       " '0515126772',\n",
       " '0312976275',\n",
       " '034541389X',\n",
       " '0446604801',\n",
       " '0142001430',\n",
       " '0345339738',\n",
       " '0553280368',\n",
       " '0060175400',\n",
       " '0553275976',\n",
       " '0671758896',\n",
       " '0345465083',\n",
       " '0316969443',\n",
       " '0446606189',\n",
       " '0449003787',\n",
       " '0140119906',\n",
       " '0345350499',\n",
       " '0449221504',\n",
       " '0440224624',\n",
       " '0515128554',\n",
       " '0345348036',\n",
       " '0345413903',\n",
       " '0767900383',\n",
       " '0553272535',\n",
       " '055356451X',\n",
       " '0446607711',\n",
       " '0385498802',\n",
       " '0671004573',\n",
       " '0842329218',\n",
       " '0425147584',\n",
       " '0385336179',\n",
       " '0515130389',\n",
       " '0345339711',\n",
       " '002542730X',\n",
       " '0061015725',\n",
       " '0446516538',\n",
       " '0441003257',\n",
       " '0142001805',\n",
       " '0425116840',\n",
       " '0099771519',\n",
       " '0451156609',\n",
       " '0446608815',\n",
       " '0684848783',\n",
       " '0553375407',\n",
       " '0060391626',\n",
       " '140003065X',\n",
       " '0440235162',\n",
       " '0684801523',\n",
       " '0553279556',\n",
       " '0439064864',\n",
       " '0060921145',\n",
       " '0446394521',\n",
       " '0451167317',\n",
       " '0312421273',\n",
       " '0804111359',\n",
       " '031298328X',\n",
       " '0385721420',\n",
       " '0743227441',\n",
       " '042510107X',\n",
       " '0440219078',\n",
       " '0553579754',\n",
       " '0425083837',\n",
       " '0553271636',\n",
       " '0553582747',\n",
       " '0451526341',\n",
       " '067088300X',\n",
       " '0425143325',\n",
       " '0345413350',\n",
       " '0449221512',\n",
       " '0385474016',\n",
       " '0449219364',\n",
       " '0425133540',\n",
       " '0553284789',\n",
       " '0312980159',\n",
       " '0553574574',\n",
       " '0749397543',\n",
       " '0525947647',\n",
       " '0440498058',\n",
       " '0446610100',\n",
       " '0553582526',\n",
       " '0441172717',\n",
       " '0451203895',\n",
       " '044022103X',\n",
       " '0380813815',\n",
       " '0312243022',\n",
       " '0312983867',\n",
       " '0151008116',\n",
       " '006016848X',\n",
       " '0375703063',\n",
       " '0440414806',\n",
       " '014100018X',\n",
       " '0671617028',\n",
       " '0451172817',\n",
       " '0553582135',\n",
       " '0385720955',\n",
       " '0671727796',\n",
       " '0553578693',\n",
       " '0375705856',\n",
       " '0671004107',\n",
       " '0449223612',\n",
       " '0385497466',\n",
       " '0316969680',\n",
       " '0786817070',\n",
       " '0449221482',\n",
       " '0446606324',\n",
       " '1558745157',\n",
       " '0375502238',\n",
       " '0425115801',\n",
       " '0446679593',\n",
       " '0345378482',\n",
       " '037570504X',\n",
       " '0440998050',\n",
       " '0449223604',\n",
       " '0671011367',\n",
       " '031242227X',\n",
       " '0440223202',\n",
       " '0446604666',\n",
       " '0449221490',\n",
       " '0812511816',\n",
       " '0446360589',\n",
       " '0743412028',\n",
       " '0425109720',\n",
       " '0515128546',\n",
       " '0451177096',\n",
       " '0553296981',\n",
       " '0449219461',\n",
       " '038550926X',\n",
       " '042513525X',\n",
       " '0553273914',\n",
       " '0553571885',\n",
       " '0425182878',\n",
       " '0671028375',\n",
       " '0425144429',\n",
       " '0060958022',\n",
       " '0671888587',\n",
       " '0061097314',\n",
       " '0440221595',\n",
       " '0446611808',\n",
       " '051513628X',\n",
       " '0316089699',\n",
       " '0671793489',\n",
       " '0553289411',\n",
       " '0670865796',\n",
       " '0425172546',\n",
       " '0767905385',\n",
       " '0446531332',\n",
       " '0440224594',\n",
       " '0679744398',\n",
       " '0553250531',\n",
       " '0425147363',\n",
       " '0345368754',\n",
       " '0385511612',\n",
       " '038082101X',\n",
       " '0451202341',\n",
       " '0553292722',\n",
       " '0345427637',\n",
       " '0679751521',\n",
       " '0345447840',\n",
       " '0671004565',\n",
       " '0399150897',\n",
       " '0373218397',\n",
       " '1558744150',\n",
       " '089480829X',\n",
       " '0312990456',\n",
       " '0446603589',\n",
       " '0345391802',\n",
       " '038549081X',\n",
       " '0671042262',\n",
       " '0786885688',\n",
       " '0679731148',\n",
       " '0380710218',\n",
       " '0312422156',\n",
       " '0440213290',\n",
       " '0345370805',\n",
       " '0671004549',\n",
       " '0671894455',\n",
       " '0156628708',\n",
       " '0446609404',\n",
       " '0446611085',\n",
       " '0679735909',\n",
       " '0452283205',\n",
       " '0446364800',\n",
       " '0312265867',\n",
       " '0671673688',\n",
       " '0345384369',\n",
       " '0452260116',\n",
       " '0671867113',\n",
       " '0743206045',\n",
       " '055321313X',\n",
       " '0425122123',\n",
       " '0743411250',\n",
       " '0743418204',\n",
       " '0440202043',\n",
       " '0375506039',\n",
       " '0515121843',\n",
       " '0451160525',\n",
       " '0670892963',\n",
       " '0671708635',\n",
       " '0312983824',\n",
       " '0553582127',\n",
       " '0425180964',\n",
       " '0385420161',\n",
       " '0345435168',\n",
       " '0553564528',\n",
       " '0802130208',\n",
       " '0452269571',\n",
       " '0375727132',\n",
       " '0743460529',\n",
       " '0671867172',\n",
       " '0842342702',\n",
       " '1878424319',\n",
       " '039592720X',\n",
       " '0670880728',\n",
       " '0316789089',\n",
       " '0345446860',\n",
       " '0786867647',\n",
       " '0670894184',\n",
       " '0441790348',\n",
       " '0446603716',\n",
       " '0671568175',\n",
       " '0373218192',\n",
       " '0553573136',\n",
       " '0399147195',\n",
       " '0553561618',\n",
       " '0743224574',\n",
       " '0345369947',\n",
       " '0385424728',\n",
       " '0743467523',\n",
       " '0374129983',\n",
       " '0425124347',\n",
       " '0451186362',\n",
       " '0446611778',\n",
       " '038533334X',\n",
       " '055356160X',\n",
       " '0452284449',\n",
       " '0060173289',\n",
       " '0425170349',\n",
       " '1558744630',\n",
       " '051512608X',\n",
       " '0553569910',\n",
       " '0385730586',\n",
       " '0515135062',\n",
       " '0330332775',\n",
       " '0452280621',\n",
       " '0440215625',\n",
       " '0671042572',\n",
       " '0385502532',\n",
       " '0446608890',\n",
       " '0345424719',\n",
       " '0345386108',\n",
       " '0553581554',\n",
       " '0375760911',\n",
       " '0679444815',\n",
       " '0140177396',\n",
       " '0451181379',\n",
       " '0060929871',\n",
       " '0515127833',\n",
       " '0552124753',\n",
       " '0743211383',\n",
       " '0064407675',\n",
       " '0451176464',\n",
       " '0425107469',\n",
       " '0380730847',\n",
       " '0373218036',\n",
       " '0394820371',\n",
       " '0449227421',\n",
       " '0449006522',\n",
       " '0743437640',\n",
       " '0446520802',\n",
       " '0802139256',\n",
       " '0064472272',\n",
       " '0316666009',\n",
       " '0451169530',\n",
       " '0553582143',\n",
       " '0316781010',\n",
       " '0515136530',\n",
       " '0842329242',\n",
       " '0679772677',\n",
       " '0060922532',\n",
       " '0375412824',\n",
       " '0380012863',\n",
       " '0425178765',\n",
       " '038529929X',\n",
       " '0743211375',\n",
       " '0316788228',\n",
       " '0380717018',\n",
       " '0385472951',\n",
       " '0060199652',\n",
       " '0385490992',\n",
       " '0446675059',\n",
       " '0316693006',\n",
       " '0553580191',\n",
       " '0345384350',\n",
       " '0345413881',\n",
       " '1400031362',\n",
       " '0553578022',\n",
       " '0446613266',\n",
       " '0451204530',\n",
       " '0515122734',\n",
       " '0064400557',\n",
       " '038542471X',\n",
       " '006019491X',\n",
       " '0515133973',\n",
       " '0446607193',\n",
       " '0446610542',\n",
       " '0312265859',\n",
       " '0440218535',\n",
       " '0345413873',\n",
       " '0425158632',\n",
       " '0399149325',\n",
       " '0553569155',\n",
       " '042513699X',\n",
       " '0684865742',\n",
       " '0345436911',\n",
       " '0679734775',\n",
       " '0671867091',\n",
       " '0425184226',\n",
       " '0679446486',\n",
       " '0316782505',\n",
       " '0316693235',\n",
       " '0316602906',\n",
       " '0399146431',\n",
       " '0671693816',\n",
       " '0451207521',\n",
       " '0380977788',\n",
       " '0385510438',\n",
       " '0452282195',\n",
       " '0316693200',\n",
       " '0385493800',\n",
       " '0140254544',\n",
       " '0743457358',\n",
       " '0316168688',\n",
       " '0060096195',\n",
       " '0425155404',\n",
       " '0399149155',\n",
       " '0515133302',\n",
       " '0316777730',\n",
       " '0451205421',\n",
       " '0440122090',\n",
       " '0451163966',\n",
       " '0553282476',\n",
       " '0345444884',\n",
       " '038542017X',\n",
       " '1592400876',\n",
       " '0743203631',\n",
       " '0446609323',\n",
       " '0316781142',\n",
       " '034538184X',\n",
       " '034536676X',\n",
       " '0688177751',\n",
       " '0804115761',\n",
       " '0399145087',\n",
       " '0425153975',\n",
       " '0515136379',\n",
       " '0425132951',\n",
       " '0449134482',\n",
       " '0091867770',\n",
       " '0451206525',\n",
       " '0553274295',\n",
       " '0373484224',\n",
       " '0552998486',\n",
       " '0553560247',\n",
       " '0767915054',\n",
       " '0671880314',\n",
       " '080213825X',\n",
       " '0684867621',\n",
       " '1573225517',\n",
       " '0446519138',\n",
       " '0142004235',\n",
       " '0060932759',\n",
       " '0446605409',\n",
       " '0312144075',\n",
       " '0375706410',\n",
       " '0380820293',\n",
       " '0399146253',\n",
       " '0553213148',\n",
       " '0671683993',\n",
       " '0446365505',\n",
       " '034539657X',\n",
       " '034543479X',\n",
       " '1573229571',\n",
       " '0425174271',\n",
       " '006099486X',\n",
       " '0375500510',\n",
       " '0312971125',\n",
       " '0345422317',\n",
       " '0451169522',\n",
       " '0425192733',\n",
       " '0316777722',\n",
       " '0316182540',\n",
       " '0345354613',\n",
       " '0553572326',\n",
       " '0609610597',\n",
       " '0425092917',\n",
       " '0345404114',\n",
       " '0671727583',\n",
       " '0425136981',\n",
       " '042518630X',\n",
       " '0451208765',\n",
       " '0060008032',\n",
       " '080411935X',\n",
       " '0330375253',\n",
       " '0451153553',\n",
       " '0373825013',\n",
       " '0553576801',\n",
       " '0425177173',\n",
       " '0515130966',\n",
       " '0446606383',\n",
       " '0515124214',\n",
       " '0385335830',\n",
       " '051511992X',\n",
       " '0380727501',\n",
       " '0060916508',\n",
       " '0679442790',\n",
       " '0312306326',\n",
       " '0684833395',\n",
       " '067976397X',\n",
       " '0374199698',\n",
       " '0156006529',\n",
       " '1576737330',\n",
       " '0671027662',\n",
       " '0451180232',\n",
       " '0140179836',\n",
       " '1551668998',\n",
       " '0425192725',\n",
       " '0385512104',\n",
       " '0061020710',\n",
       " '067101420X',\n",
       " '0804105820',\n",
       " '0553265741',\n",
       " '0842329250',\n",
       " '0440241162',\n",
       " '0446603929',\n",
       " '0345348109',\n",
       " '0060512822',\n",
       " '0446602620',\n",
       " '0451197747',\n",
       " '0316602051',\n",
       " '0345445848',\n",
       " '0553580930',\n",
       " '0440200989',\n",
       " '0449912558',\n",
       " '0553569058',\n",
       " '0446525502',\n",
       " '0451170385',\n",
       " '1573227331',\n",
       " '0373218400',\n",
       " '0345441036',\n",
       " '0446667900',\n",
       " '0553274503',\n",
       " '0679735771',\n",
       " '0425151867',\n",
       " '0553571818',\n",
       " '0743437802',\n",
       " '0425185710',\n",
       " '0385424736',\n",
       " '1400031346',\n",
       " '0553583441',\n",
       " '051512317X',\n",
       " '0425147517',\n",
       " '0373484003',\n",
       " '0446530522',\n",
       " '0688177859',\n",
       " '0312982518',\n",
       " '0671027581',\n",
       " '0446363251',\n",
       " '0446670111',\n",
       " '0894805770',\n",
       " '0671011375',\n",
       " '0451188454',\n",
       " '0553280414',\n",
       " '0312274920',\n",
       " '076790592X',\n",
       " '0743206029',\n",
       " '0385475721',\n",
       " '0887307876',\n",
       " '0515120618',\n",
       " '043936213X',\n",
       " '0312244266',\n",
       " '0345314255',\n",
       " '0449910237',\n",
       " '0452268060',\n",
       " '042517736X',\n",
       " '0345422384',\n",
       " '0451188462',\n",
       " '0380814021',\n",
       " '0380817691',\n",
       " '0451191145',\n",
       " '0345416260',\n",
       " '080411918X',\n",
       " '0345413865',\n",
       " '0316678104',\n",
       " '0385503954',\n",
       " '0804108749',\n",
       " '0345366239',\n",
       " '0671741195',\n",
       " '0425178579',\n",
       " '034538430X',\n",
       " '0425150143',\n",
       " '044661064X',\n",
       " '0425178102',\n",
       " '0446525537',\n",
       " '0345397819',\n",
       " '1558745718',\n",
       " '081297106X',\n",
       " '0671014919',\n",
       " '0449203794',\n",
       " '0743235150',\n",
       " '0671537458',\n",
       " '0786866586',\n",
       " '0380710722',\n",
       " '0345354621',\n",
       " '0345413369',\n",
       " '0425119653',\n",
       " '0425142485',\n",
       " '0425166619',\n",
       " '0140042598',\n",
       " '0451209907',\n",
       " '0440217490',\n",
       " '0671027344',\n",
       " '0451169514',\n",
       " '0786889020',\n",
       " '0374100128',\n",
       " '0446350982',\n",
       " '0375504397',\n",
       " '0452281903',\n",
       " '0316693251',\n",
       " '0425121631',\n",
       " '0671038443',\n",
       " '0425145638',\n",
       " '0743439740',\n",
       " '0515135739',\n",
       " '0671525743',\n",
       " '0425161242',\n",
       " '1400032717',\n",
       " '0312966806',\n",
       " '0385720920',\n",
       " '0385508417',\n",
       " '0312924801',\n",
       " '0425189864',\n",
       " '0446604844',\n",
       " '0679723161',\n",
       " '0425140032',\n",
       " '0316603287',\n",
       " '0553295977',\n",
       " '0671026011',\n",
       " '0060926317',\n",
       " '0446605581',\n",
       " '067169507X',\n",
       " '0679731725',\n",
       " '0140092323',\n",
       " '0316693286',\n",
       " '0375413634',\n",
       " '0440225825',\n",
       " '0425130711',\n",
       " '0375412530',\n",
       " '0425172996',\n",
       " '0312986343',\n",
       " '0684862719',\n",
       " '0446365386',\n",
       " '0671701231',\n",
       " '055357230X',\n",
       " '0099387913',\n",
       " '0671743058',\n",
       " '0440217563',\n",
       " '0525946829',\n",
       " '0553258001',\n",
       " '0670030643',\n",
       " '0446527785',\n",
       " '0440940001',\n",
       " '042510687X',\n",
       " '0449911519',\n",
       " '0451186923',\n",
       " '0312978383',\n",
       " '0312263120',\n",
       " '0553263226',\n",
       " '0743418131',\n",
       " '0425157539',\n",
       " '0425179613',\n",
       " '0446604232',\n",
       " '1573229725',\n",
       " '0425167720',\n",
       " '0553584510',\n",
       " '0446356832',\n",
       " '0385503857',\n",
       " '006092988X',\n",
       " '0312983298',\n",
       " '034540761X',\n",
       " '0451142934',\n",
       " '015100692X',\n",
       " '0312974256',\n",
       " '0553582763',\n",
       " '0671028367',\n",
       " '044661193X',\n",
       " '0446604275',\n",
       " '0345404769',\n",
       " '0805059555',\n",
       " '0671886665',\n",
       " '0425179885',\n",
       " '0425189031',\n",
       " '0767916069',\n",
       " '0425181103',\n",
       " '0451166582',\n",
       " '0553572210',\n",
       " '042518286X',\n",
       " '0446608262',\n",
       " '1558531025',\n",
       " '000649840X',\n",
       " '0060740450',\n",
       " '0679457526',\n",
       " '0312952716',\n",
       " '0373243286',\n",
       " '0373484232',\n",
       " '067697175X',\n",
       " '0312201656',\n",
       " '0345392825',\n",
       " '0679439382',\n",
       " '1565122968',\n",
       " '0671670689',\n",
       " '0156028778',\n",
       " '0553582658',\n",
       " '0446523569',\n",
       " '0553583468',\n",
       " '0425151875',\n",
       " '0671024094',\n",
       " '0670894605',\n",
       " '0553210092',\n",
       " '0553213172',\n",
       " '0515087122',\n",
       " '0440201926',\n",
       " '0671034022',\n",
       " '0689817851',\n",
       " '0553212583',\n",
       " '0425121259',\n",
       " '0345386132',\n",
       " '0440236738',\n",
       " '0440204194',\n",
       " '0805019375',\n",
       " '0440211891',\n",
       " '0812570944',\n",
       " '0028604199',\n",
       " '0446673544',\n",
       " '0373244487',\n",
       " '067100042X',\n",
       " '0671250671',\n",
       " '0451163524',\n",
       " '0679720200',\n",
       " '0425118703',\n",
       " '0440221315',\n",
       " '0553578316',\n",
       " '0451151259',\n",
       " '0553211404',\n",
       " '0671023616',\n",
       " '0441005489',\n",
       " '0812543262',\n",
       " '0743469801',\n",
       " '006109921X',\n",
       " '0440236053',\n",
       " '0060964049',\n",
       " '0316693324',\n",
       " '0375705198',\n",
       " '0156007479',\n",
       " '0345447867',\n",
       " '0553573403',\n",
       " '0767905202',\n",
       " '0743417682',\n",
       " '0345384377',\n",
       " '0553278029',\n",
       " '0553208845',\n",
       " '0446607207',\n",
       " '0061098795',\n",
       " '0345452569',\n",
       " '0385509456',\n",
       " '0385490445',\n",
       " '0425152898',\n",
       " '0671776134',\n",
       " '0316690619',\n",
       " '0553586122',\n",
       " '0590660543',\n",
       " '0425162788',\n",
       " '0330262130',\n",
       " '0375703764',\n",
       " '0440224705',\n",
       " '0060930187',\n",
       " '0805062971',\n",
       " '0446353205',\n",
       " '0380703882',\n",
       " '0385494246',\n",
       " '0671028383',\n",
       " '0064471047',\n",
       " '0786862564',\n",
       " '0142002267',\n",
       " '0679742298',\n",
       " '055356773X',\n",
       " '0375414053',\n",
       " '0385314698',\n",
       " '0373484410',\n",
       " '0440176484',\n",
       " '0446527165',\n",
       " '0345396936',\n",
       " '0385315236',\n",
       " '0446530077',\n",
       " '0385482388',\n",
       " '0345389964',\n",
       " '0446604402',\n",
       " '155166674X',\n",
       " '0515118656',\n",
       " '0425169693',\n",
       " '0679419462',\n",
       " '0553578308',\n",
       " '0671729411',\n",
       " '1857022424',\n",
       " '0399143947',\n",
       " '0671741187',\n",
       " '0380600129',\n",
       " '0373483694',\n",
       " '8873122933',\n",
       " '0425161722',\n",
       " '0786890436',\n",
       " '0684857820',\n",
       " '0451191013',\n",
       " '0440207622',\n",
       " '0373484429',\n",
       " '0552137030',\n",
       " '0060188731',\n",
       " '0061000175',\n",
       " '0345441133',\n",
       " '0451190491',\n",
       " '0553579983',\n",
       " '0446611476',\n",
       " '0451203593',\n",
       " '0061031992',\n",
       " '0553562614',\n",
       " '0441304834',\n",
       " '0446609943',\n",
       " '0330367358',\n",
       " '0446601640',\n",
       " '0451155750',\n",
       " '0552996181',\n",
       " '0805036504',\n",
       " '0312979096',\n",
       " '0375400117',\n",
       " '0425146413',\n",
       " '1931561648',\n",
       " '0515132136',\n",
       " '0671002481',\n",
       " '0440220424',\n",
       " ...]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "top2000_item_id_s = df_data_training['item_id'].value_counts()[:2000].index.tolist()\n",
    "top2000_item_id_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>user_id</th>\n",
       "      <th>location</th>\n",
       "      <th>age</th>\n",
       "      <th>item_id</th>\n",
       "      <th>rating</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>9</td>\n",
       "      <td>usa</td>\n",
       "      <td>0</td>\n",
       "      <td>0440234743</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>9</td>\n",
       "      <td>usa</td>\n",
       "      <td>0</td>\n",
       "      <td>0452264464</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>14</td>\n",
       "      <td>usa</td>\n",
       "      <td>0</td>\n",
       "      <td>0971880107</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>16</td>\n",
       "      <td>usa</td>\n",
       "      <td>0</td>\n",
       "      <td>0345402871</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>16</td>\n",
       "      <td>usa</td>\n",
       "      <td>0</td>\n",
       "      <td>0345417623</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    user_id location  age     item_id  rating\n",
       "20        9      usa    0  0440234743       0\n",
       "21        9      usa    0  0452264464       6\n",
       "29       14      usa    0  0971880107       0\n",
       "30       16      usa    0  0345402871       9\n",
       "31       16      usa    0  0345417623       0"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_data_training_top2000 = df_data_training[\n",
    "    df_data_training['item_id'].isin(top2000_item_id_s)\n",
    "]\n",
    "df_data_training_top2000.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 159956 entries, 20 to 1149771\n",
      "Data columns (total 5 columns):\n",
      "user_id     159956 non-null int64\n",
      "location    159956 non-null object\n",
      "age         159956 non-null int64\n",
      "item_id     159956 non-null object\n",
      "rating      159956 non-null int64\n",
      "dtypes: int64(3), object(2)\n",
      "memory usage: 7.3+ MB\n"
     ]
    }
   ],
   "source": [
    "df_data_training_top2000.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['1844262553',\n",
       " '0439139597',\n",
       " '0439136350',\n",
       " '0439064864',\n",
       " '0877017883',\n",
       " '0618002227',\n",
       " '0590353403',\n",
       " '0671027344',\n",
       " '0385199570',\n",
       " '0771060548',\n",
       " '0156528207',\n",
       " '0618129022',\n",
       " '0552131059',\n",
       " '0811801802',\n",
       " '0670032379',\n",
       " '0812550706',\n",
       " '0375756981',\n",
       " '0679785892',\n",
       " '0670894605',\n",
       " '0811825558']"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "top20_item_id_s = df_data_training_top2000.groupby('item_id')['rating'].mean().sort_values(ascending=False)[:20].index.tolist()\n",
    "top20_item_id_s"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "for location in feature_recommand.keys():\n",
    "    for age in feature_recommand[location].keys():\n",
    "        feature_recommand_len = len(feature_recommand[location][age])\n",
    "        feature_recommand[location][age] += top20_item_id_s[:20-feature_recommand_len]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 保存数据\n",
    "cPickle.dump(\n",
    "    feature_recommand,\n",
    "    open('../data/feature_recommand.pkl', 'wb')\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
